/* ===================================
   粘贴按钮样式
   =================================== */

/* 1. 标准粘贴按钮样式 (.btn-paste) */
.btn-paste {
    padding: 8px 16px;
    background: var(--bg-tertiary, #e8e8e8);
    color: var(--text-primary, #333333);
    border: 1px solid var(--border-color, #d0d0d0);
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn-paste:hover {
    background: var(--border-color, #d0d0d0);
    opacity: 0.9;
}

.btn-paste:active {
    opacity: 0.8;
}

.btn-paste:focus {
    outline: 2px solid var(--border-color, #d0d0d0);
    outline-offset: 2px;
}

/* 2. 透明粘贴按钮样式 (.paste-btn-transparent) */
/* 用于输入框内部右下角 */
.paste-btn-transparent {
    position: absolute;
    right: 10px;
    bottom: 10px;
    width: 36px;
    height: 36px;
    border: none;
    background: rgba(52, 152, 219, 0.1);
    color: #3498db;
    font-size: 18px;
    cursor: pointer;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    z-index: 10;
}

.paste-btn-transparent:hover {
    background: rgba(52, 152, 219, 0.2);
}

.paste-btn-transparent:active {
    transform: scale(0.95);
}

.paste-btn-transparent:focus {
    outline: 2px solid #3498db;
    outline-offset: 2px;
}

/* 3. 内联粘贴按钮样式 (.btn-paste-inline) */
/* 用于输入框旁边 */
.btn-paste-inline {
    padding: 8px 16px;
    background: var(--bg-tertiary, #e8e8e8);
    color: var(--text-primary, #333333);
    border: 1px solid var(--border-color, #d0d0d0);
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn-paste-inline:hover {
    background: var(--border-color, #d0d0d0);
    opacity: 0.9;
}

.btn-paste-inline:active {
    opacity: 0.8;
}

.btn-paste-inline:focus {
    outline: 2px solid var(--border-color, #d0d0d0);
    outline-offset: 2px;
}

/* ===================================
   Toast通知样式
   =================================== */

.toast-notification {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 12px 20px;
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 10000;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    animation: slideIn 0.3s ease;
    max-width: 400px;
    word-wrap: break-word;
}

.toast-notification.success {
    background-color: #d5f4e6;
    color: #27ae60;
    border-left: 4px solid #27ae60;
}

.toast-notification.error {
    background-color: #fadbd8;
    color: #e74c3c;
    border-left: 4px solid #e74c3c;
}

.toast-notification.info {
    background-color: #d6eaf8;
    color: #3498db;
    border-left: 4px solid #3498db;
}

.toast-notification.hiding {
    animation: slideOut 0.3s ease forwards;
}

/* Toast图标 */
.toast-notification::before {
    content: '';
    font-size: 18px;
    line-height: 1;
}

.toast-notification.success::before {
    content: '✓';
}

.toast-notification.error::before {
    content: '✕';
}

.toast-notification.info::before {
    content: 'ℹ';
}

/* ===================================
   动画效果
   =================================== */

@keyframes slideIn {
    from {
        transform: translateX(400px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideOut {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(400px);
        opacity: 0;
    }
}

/* ===================================
   暗色主题支持
   =================================== */

@media (prefers-color-scheme: dark) {
    .btn-paste,
    .btn-paste-inline {
        background: var(--bg-tertiary, #2d2d30);
        color: var(--text-primary, #d4d4d4);
        border-color: var(--border-color, #3e3e42);
    }
    
    .btn-paste:hover,
    .btn-paste-inline:hover {
        background: var(--border-color, #3e3e42);
    }
    
    .paste-btn-transparent {
        background: rgba(52, 152, 219, 0.15);
    }
    
    .paste-btn-transparent:hover {
        background: rgba(52, 152, 219, 0.25);
    }
    
    .toast-notification.success {
        background-color: #1e4d2b;
        color: #5ddb7a;
    }
    
    .toast-notification.error {
        background-color: #4d1e1e;
        color: #ff6b6b;
    }
    
    .toast-notification.info {
        background-color: #1e3a4d;
        color: #5dade2;
    }
}

/* ===================================
   可访问性增强
   =================================== */

/* 键盘导航时的焦点样式 */
.btn-paste:focus-visible,
.btn-paste-inline:focus-visible {
    outline: 2px solid var(--border-color, #d0d0d0);
    outline-offset: 2px;
}

.paste-btn-transparent:focus-visible {
    outline: 2px solid #3498db;
    outline-offset: 2px;
}

/* 禁用状态 */
.btn-paste:disabled,
.btn-paste-inline:disabled,
.paste-btn-transparent:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-paste:disabled:hover,
.btn-paste-inline:disabled:hover {
    background: var(--bg-tertiary, #e8e8e8);
    opacity: 0.5;
}

.paste-btn-transparent:disabled:hover {
    background-color: transparent;
    transform: none;
}

/* 减少动画效果（用户偏好） */
@media (prefers-reduced-motion: reduce) {
    .btn-paste,
    .btn-paste-inline,
    .paste-btn-transparent,
    .toast-notification {
        transition: none;
        animation: none;
    }
    
    .toast-notification {
        animation: none;
    }
}

/* ===================================
   页面特定样式覆盖
   =================================== */

/* JSON对比和文本对比页面 - 使用较小的按钮 */
.text-comparator .btn-paste,
.json-comparator .btn-paste {
    padding: 6px 12px;
    font-size: 12px;
}

/* 日期时间转换页面 - 调整粘贴按钮位置 */
.paste-btn {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    width: 30px;
    height: 30px;
    border: none;
    background: transparent;
    color: #3498db;
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

.paste-btn:hover {
    background: #ecf0f1;
}

.paste-btn:active {
    transform: translateY(-50%) scale(0.95);
}

.paste-btn:focus {
    outline: 2px solid #3498db;
    outline-offset: 2px;
}

/* 暗色主题下的 paste-btn */
@media (prefers-color-scheme: dark) {
    .paste-btn:hover {
        background: rgba(52, 152, 219, 0.2);
    }
}
